package com.gitee.qdbp.base.orm.mybatis.converter;

/**
 * DataState type handler
 *
 * @author zhaohuihua
 * @version 170524
 * @since V3.3.0
 */
public class DataStateTypeHandler<E extends Enum<E>> extends EnumSmartHandler<E> {

    public DataStateTypeHandler(Class<E> type) {
        super(type);
        this.useOrdinal = true;
        this.withoutToDefault = true;
    }

    protected E getWithoutDefaultValue() {
        // DataState 以随机数表示删除, 因此, 凡不在枚举列表中的值, 返回DataState.DELETED
        return enums[enums.length - 1];
    }

}
